package consts

const (
	AssetsPath  = "assets/"
	ConfigPath  = AssetsPath + "config/"
	I18nPath    = AssetsPath + "i18n/"
	PemPath     = AssetsPath + "pem/"
	CodeGenPath = AssetsPath + "codegen/"

	ApplicationDataId        = "application.yml"
	ApplicationStorageDataId = "application-storage.yml"
	BootstrapDataId          = "bootstrap.yml"

	LanguageZhCN = "zh-CN"
	LanguageEnUS = "en-US"

	Lang_Validator_Zh = "zh"
	Lang_Validator_En = "en"

	// DebugMode indicates  mode is debug.
	DebugMode = "debug"
	// ReleaseMode indicates  mode is release.
	ReleaseMode = "release"
	// TestMode indicates  mode is test.
	TestMode = "test"

	Config_Type_Native = "native"
	Config_Type_Nacos  = "nacos"
	Config_Type_Etcd   = "etcd"

	//auth state group
	AuthState_Key = "auth-key"
	//公开的，不做auth
	AuthState_Public = "public"
	//配置在auth路径下，但是不强制且auth不通过: 查看no-force-auth配置
	AuthState_NoAuth = "no-auth"
	//配置auth,且auth通过
	AuthState_Auth = "auth"

	RedisMode_Sentinel   = "sentinel"
	RedisMode_Standalone = "standalone"
	RedisMode_Cluster    = "cluster"
	RedisMode_Shard      = "shard"
	//http请求
	HTTP = "http://"
	//https请求
	HTTPS = "https://"

	// www主域
	WWW = "www."

	Pwd_Transfer_Ver_Sm2 = "sm2"
	PwdPrivatekeyFile    = "sm2Private.pem"

	//对称加密key: sm4
	Symmetry_Trans_Encrypt_Key  = "98eadc356f01de1054ea4fabc4b54ea1"
	Symmetry_Store_Enccrypt_key = "567231ed2a9c0b98fe8e876aefcd0132"
	Sm4_IV                      = "01ea2390876547edf3a46e78c89b5400"
	Sm4_Trans_Pem_File          = "sm4_trans.pem"
	Sm4_Store_Pem_File          = "sm4_store.pem"

	Key_DataScope = "DataScope"

	Max_Upload_Filename_Length = 100
	Default_Upload_Dir         = AssetsPath + "upload/"

	System_Status_Starting = "STARTING"
	System_Status_Running  = "UP"
	System_Status_Stopping = "STOPPING"
)

var (

	//0-未知，1-jwt，2-bearea,3-oauth2
	TokenTypeMap = map[string]int{
		Request_Token_Type_Bearer: 2,
		Request_Token_Type_Oauth2: 3,
		Request_Token_Type_Basic:  0,
		Request_Token_Type_Jwt:    1,
		Request_Token_Type_None:   0,
	}

	IMAGE_EXTENSION = []string{"bmp", "gif", "jpg", "jpeg", "png"}
	MEDIA_EXTENSION = []string{"swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
		"asf", "rm", "rmvb"}
	VIDEO_EXTENSION           = []string{"mp4", "avi", "rmvb"}
	DEFAULT_ALLOWED_EXTENSION = []string{
		// 图片
		"bmp", "gif", "jpg", "jpeg", "png",
		// word excel powerpoint
		"doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
		// 压缩文件
		"rar", "zip", "gz", "bz2",
		// 视频格式
		"mp4", "avi", "rmvb",
		// pdf
		"pdf"}
)

// request gin
const (
	Request_Token_Type_Bearer = "bearer"
	Request_Token_Type_Oauth2 = "oauth2"
	Request_Token_Type_Basic  = "basic"
	Request_Token_Type_Jwt    = "jwt"
	Request_Token_Type_None   = "none"

	DefaultAuth_Bearer_Headerkey = "Authorization"
	Bearer_Token_Prefix          = "Bearer "

	//jwt header key
	DefaultAuth_Jwt_HeaderKey = "MO-TOKEN"
	//oauth header key
	DefaultAuth_Oauth_HeaderKey = "MO-OAUTH"

	GinContext_AuthType_Key   = "mo-req-auth-type"
	GinContext_Model_Key      = "mo-req-model"
	GinContext_Claims_Key     = "mo-req-claims"
	GinContext_Token_Key      = "mo-req-token"
	GinContext_OnlineUser_Key = "mo-req-online-user"

	GinContext_LoginState_Key = "mo-req-login-state"
	GinContext_OperLog_key    = "mo-req-oper-log"
	GinUnknow_Ip              = "unknow"
)

// error code
const (
	// Comm 常用业务状态码
	CommStatusOkCode             int = 200
	ValidatorParamsCheckFailCode int = -100300

	//服务器代码发生错误
	ServerOccurredErrorCode  int = -500100
	CommCreatFailCode        int = -100200
	CommUpdateFailCode       int = -100201
	CommDeleteFailCode       int = -100202
	CommSelectFailCode       int = -100203
	CommRegisterFailCode     int = -100204
	CommLoginFailCode        int = -100205
	CommRefreshTokenFailCode int = -100206
	CommonAuthInvalidateCode int = 401

	DataScopeLimitedCode int = -100249
	//文件上传
	FilesUploadFailCode int = -100250

	FilesUploadMoreThanMaxSizeCode int = -100251
	FilesUploadMimeTypeFailCode    int = -100252

	//验证码
	CaptchaGetParamsInvalidCode int = -100350

	CaptchaCheckParamsInvalidCode int = 500
	CaptchaGenFailCode            int = -100352
	CaptchaClosedCode             int = -100353
	CaptchaCheckFailCode          int = -100355
)
